package thread;
//join可能出发阻塞，但是也不一定触发
//比如main等待t join 之前，t线程就已经结束了，那么join方法就不会阻塞了
public class Demo13 {
    public static void main(String[] args) throws InterruptedException {
         Thread t = new Thread(() -> {
            for(int i=0;i<3;i++){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        });
        t.start();
        Thread.sleep(4000);
        System.out.println("t开始等待");
        t.join();
        System.out.println("t结束等待");
    }
}
